stringlist: Make property not construct-only
authorBenjamin Otte <otte@redhat.com>
Mon, 29 Jun 2020 22:35:25 +0000 (00:35 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 5 Jul 2020 00:59:21 +0000 (02:59 +0200)
Massively speeds up creation of long stringlists.

gtk/gtkstringlist.c

index 61e8847d6d52dc5f14cba9272b8366f1afe504f4..2b43f70e5d7e5b26e816e0ae960270fd239fe685 100644 (file)
@@ -138,8 +138,7 @@ gtk_string_object_class_init (GtkStringObjectClass *class)
 
   pspec = g_param_spec_string ("string", "String", "String",
                                NULL,
-                               G_PARAM_READWRITE |
-                               G_PARAM_CONSTRUCT_ONLY |
+                               G_PARAM_READABLE |
                                G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_property (object_class, PROP_STRING, pspec);
@@ -149,7 +148,12 @@ gtk_string_object_class_init (GtkStringObjectClass *class)
 static GtkStringObject *
 gtk_string_object_new (const char *string)
 {
-  return g_object_new (GTK_TYPE_STRING_OBJECT, "string", string, NULL);
+  GtkStringObject *result;
+
+  result = g_object_new (GTK_TYPE_STRING_OBJECT, NULL);
+  result->string = g_strdup (string);
+
+  return result;
 }
 
 static GtkStringObject *